<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNoticesTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('notices', function (Blueprint $table) {
            $table->id();
            $table->string('title')->comment('公告标题');
            $table->string('slug')->unique()->comment('SEO友好URL');
            $table->text('content')->comment('公告内容（富文本）');
            $table->enum('type', ['notice', 'alert', 'maintenance'])->default('notice')->comment('公告类型');
            $table->boolean('is_pinned')->default(false)->comment('是否置顶');
            $table->boolean('is_active')->default(true)->comment('是否生效');
            $table->timestamp('publish_at')->useCurrent()->comment('发布时间');
            $table->timestamp('expire_at')->nullable()->comment('过期时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('notices');
    }
}
